package com.example.rabbit.controller;


import com.example.rabbit.service.Receiver;
import com.example.rabbit.service.Sender;
import com.example.rabbit.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:MuJiuTian
 * @Description:
 * @Date: Created in 下午10:23 2019/8/19
 */
@RestController
public class AckController {

    @Autowired
    private Sender sender;

    @Autowired
    private Receiver receiver;

    @RequestMapping(value = "/ackdemo")
    public void send(){
            sender.send("ack_queue","hello-ack ,我是一个生产者");
    }


    // 生产信息，并抓取信息进行 手动回执
    @RequestMapping(value = "/ack")
    public void ack(){
        sender.send("ack_queue","hello-ack ,我是一个生产者");
        receiver.getMessageAck("ack_queue");
    }

    // 生产信息，并抓取信息进行 自动回执
    @RequestMapping(value = "/noAck")
    public void noAck(){
        sender.send("ack_queue","hello-ack ,我是一个生产者");
        receiver.getMessageNoAck("ack_queue");
    }
}
